package twentytwenty;

import java.util.Arrays;

/**
 * @Author: Zahi
 * @Description:
 * @Date Created in 2020-12-11 15:15
 * @Modified By:
 */
public class MissingNumber_268 {
    public static void main(String[] args) {
        int [] nums = new int[]{0};
        System.out.println(missingNumber(nums));
    }

    public static int missingNumber(int[] nums) {
        int len = nums.length;
        Arrays.sort(nums);
        for (int i = 0; i <= len; i++) {
            if (i == len || nums[i] != i){
                return i;
            }
        }
        return 0;
    }
}
